<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Packages\LaravelSms\Contracts\Notifications\AlidayuNotification;
use Packages\LaravelSms\Messages\TemplateMessage;

class SmsCode extends Notification implements AlidayuNotification
{
    use Queueable;

    /**
     * 短信验证码
     *
     * @var string
     */
    protected $code;

    /**
     * SmsCode constructor.
     *
     * @param string $code
     */
    public function __construct($code)
    {
        $this->code = $code;
    }

    /**
     * 通道
     *
     * @return array
     */
    public function via()
    {
        return ['alidayu'];
    }

    /**
     * 发送到阿里大于
     *
     * @param \Illuminate\Notifications\AnonymousNotifiable|\Illuminate\Notifications\Notifiable $notifiable
     * @return TemplateMessage
     */
    public function toAlidayu($notifiable)
    {
        return new TemplateMessage('SMS_124215027', [
            'code' => $this->code
        ]);
    }
}